Repository navigation
fix(cli): run --extract on every ending, not only done - #71
Merged
Merged
Conversation
An extract's lifetime is the page the run ended on, not the ending that got there. It ran only on the done path, so a run that stopped blocked or out of budget threw away the lines the caller had asked for by name - even though the session is still live on exactly that page. The extract now runs from stop(), which is every non-error ending; the error path never reaches it, since a broken driver has no page to read. On a non-done ending a failed extract is one line and the original exit code stands, so a caller branching on 3 or 4 never sees it turn into a 1.
tenequm
force-pushed
the
fix/extract-any-exit
branch
from
September 18, 2026 18:02
5d45ef9 to
227852b
Compare
tenequm
marked this pull request as ready for review
September 18, 2026 18:32
This was referenced Sep 18, 2026
tenequm
added a commit
that referenced
this pull request
Sep 18, 2026
…plete THIRD-PARTY (#76) Docs-only follow-up to the jev-browse, lease and `--name`/`--context` merges (#66, #67, #69, #70, #71, #74). Fixes statements that are wrong on `main` today and fills the redistribution gaps in `docs/THIRD-PARTY.md`. No code, no SKILL.md, no CLI help text (those are a separate PR). Deliberately untouched: README's `--idle-timeout` wording (owned by #73), and nothing here documents #72 masking or #73 idle stop. ## Changes, each checked against the code **README.md** - `cuttle open` does not hold until Ctrl-C: it returns unless `--wait`/`--until` is given. Evidence: `packages/cuttle/internal/cli/commands.go` `newOpenCmd` Short/Long and the `runOpen` doc comment ("then returns"). Fixed in the quickstart comment and the contexts bullet. - "The Dockerfile is Python-free" was false. `ops/docker/Dockerfile:10-13` (openbox depends on `python3-minimal`) and AGENTS.md say so; the image also ships Node for the bundled driver (`Dockerfile:345-348`). Replaced with the accurate wording. - Driver line now leads with the bundled playwright-cli and says any other CDP client can attach, instead of naming agent-browser/browser-use (the image never shipped either; `Dockerfile:67-81` installs only `@playwright/cli`). - jev-browse is marked experimental. The anchor `#autonomous-browsing-loop-jev-browse` still resolves, since the OPERATING heading is unchanged. - Licensing paragraph lists playwright-cli (Apache-2.0), Node.js (MIT) and the persona fonts. **docs/THIRD-PARTY.md** - New: `@playwright/cli` 0.1.20 plus `playwright` and `playwright-core` 1.64.0-alpha-2026-09-14. Read from the installed `package.json` files in a locally built image: all `"license": "Apache-2.0"`, author Microsoft Corporation. The image ships each package's `LICENSE`, and `playwright`/`playwright-core` also ship `NOTICE` (quoted verbatim) and `ThirdPartyNotices.txt`. - New: Node.js, the `node` binary copied from `node:22-trixie-slim` (`Dockerfile:73,345`). MIT for Node itself, from the v22 `LICENSE`, plus its bundled dependencies. The image carries the binary but not Node's LICENSE file (checked: it is absent from both `node:22-trixie-slim` and the cuttle image), so the doc links the full text. - Replaced "Windows font pack (OFL 1.1)" with "Persona font packs". The old section claimed OFL for everything, but the packs (`Dockerfile:97-190`) also include WenQuanYi Zen Hei (GPL-2 with font embedding exception, plus the M+ FONTS License), IPAGothic (IPA Font License 1.0), Loma (GPL-2+ with font exception) and, in the macOS pack, DejaVu (Bitstream Vera license). Every license was read from `/usr/share/doc/<pkg>/copyright` after installing the exact Debian trixie packages the `fontbase` stage installs. The old section also pointed at font files "under `ops/docker/winfonts/`", which has held only a README since the pack moved to build time. - The claim that copyright and license records survive renaming is backed by `scripts/rename-fonts.py:44-52`, which rewrites only name IDs 1, 3, 4, 6 and 16. - New short "Debian packages" section. Their copyright files ship at `/usr/share/doc/<pkg>/copyright` (checked in the image: 343 entries, openbox and kasmvncserver included). **ops/docker/winfonts/README.md** - Stale paths and stage names fixed: `/opt/winfonts` and `fontpack` became `/opt/personafonts` and `personafonts-amd64` (`Dockerfile:112,304,319`). The old `docker build --target fontpack` no longer works. License column corrected for WQY and Loma to match the Debian copyright files. **docs/OPERATING.md** - Driver section: `cuttle pw --help` is the wrapper's help, and `cuttle pw <verb> --help` passes through to the driver. Evidence: `cli/playwright.go` `runPlaywright` intercepts a leading `-h`/`--help`; `playwrightReadOnly` passes help through the lease gate. playwright-cli 0.1.20 has no `help` verb: `playwright-cli help` prints `Unknown command: help`. - Driver section: never re-run `attach`/`open` mid-session. Both call `startSession`, which stops the existing session, and `open` with no URL goes to `about:blank` (playwright-core `lib/tools/cli-client/program.js`, `startSession` and `case "open"`). - jev-browse: marked experimental. Also documents: the positional task as sugar for `--task` (`cli/jevbrowse.go` `jevTask`); `--url` required on a blank session (`jev/loop.go` `errNoStartPage` and its `step == 1 && l.URL == ""` check); `--extract` runs on every ending (`jev/loop.go` `stop`); and phrasing tasks as reaching a page, because a run ends done only at `dec.Done >= doneThreshold` (0.8, `jev/decide.go`); the handoff keeps the same `--name`/`--context`. - Lease: `cuttle pw` never takes the lease itself. `gatePlaywright` in `cli/lease.go` only reads it or force-releases on `--takeover`, so concurrent `cuttle pw` agents are not serialized. - Secrets: `cuttle --name staging secret ls` replaces the redundant `--cdp-port 9333`. `--name` is a root persistent flag (`cli/commands.go` `addInstanceFlags`), and secret verbs go through `sessionEndpoint` then `resolveRunning`, which discovers published ports. - Ports: the auto-discovering verbs are now listed completely (`status`, `open`, `downloads`, `secret`, `auth`, `grab`, `down`, which are all `resolveRunning` callers), and `pw`/`jev-browse` exec in the container with no host port (`playwrightExecer`). **AGENTS.md** - Layout listed a nonexistent "profile store" package. It now matches `packages/cuttle/internal/`: atomicfile, backend, cdp, cli, config, fingerprint, jev, mask, serve and xdg. `docs/plans/` added. **docs/knowledge (OKF, hand-indexed; descriptions unchanged, so `index.md` is unchanged)** - `references/jev-browser-cli-surfaces.md` said "`--task` (required)" and "no positional sugar". Both are contradicted by `cli/jevbrowse.go` (`Use: "jev-browse [task]"`, `jevTask`). Rewritten, `--takeover` added with a link to the lease decision, and `generated` bumped. - `findings/playwright-cli-attach-model.md`: added that `open` restarts the session like `attach` and goes to `about:blank` with no URL, and that there is no `help`/`docs` verb. New source `core` (playwright-core at the pinned version); `generated` bumped. **Polish pass (ba328ba)** - `findings/playwright-cli-attach-model.md` said `attach` discards tabs. A live re-attach and `open` against the pinned playwright-cli in the image kept all three tabs (reordered); only refs and the current-tab selection reset. Corrected; OPERATING now says `open` with no URL navigates the *current tab* to `about:blank`. - README: `--wait` holds until the page leaves the URL's origin, `--until` until its condition (was "reaches a condition" for both). - Comment-only, out of the docs tree: `ops/docker/Dockerfile` (two comments) and `packages/browser/validate/smoke.py` still named the removed `fontpack` stage and `/opt/winfonts`. ## Verification - `just check` green (lint, version-files, 725 tests). Commit is signed. - All changed files are ASCII-only. The license URLs return 200. - Knowledge frontmatter parses with `type`/`description`/`generated` present, and the new bundle-relative link resolves. ## Release notes Docs: README no longer says `cuttle open` holds until Ctrl-C or that the image is Python-free, jev-browse is marked experimental, and THIRD-PARTY now covers the bundled playwright-cli, Node.js and every persona font license.
tenequm
added a commit
that referenced
this pull request
Sep 21, 2026
🤖 I have created a release *beep* *boop* --- ## [0.15.0](v0.14.2...v0.15.0) (2026-09-21) ### Features * bundle playwright-cli into the image with a cuttle pw passthrough ([#67](#67)) ([28d9846](28d9846)) * **cli:** center the skill and briefing on cuttle pw, drop host driver routing ([#75](#75)) ([33eca16](33eca16)) * **cli:** colored jev-browse output ([#70](#70)) ([cf6f109](cf6f109)) * **cli:** cuttle jev-browse - autonomous browsing loop on the bundled driver ([#66](#66)) ([0496957](0496957)) * **cli:** deliver pw action snapshots as a host file, secrets masked ([#103](#103)) ([78adbbb](78adbbb)) * **cli:** make --context/--name global so pw and jev-browse reach any instance ([#74](#74)) ([9df5c33](9df5c33)) * **cli:** zero-ceremony cuttle pw - auto-attach on demand, allow open ([a7e6491](a7e6491)) * **jev:** withhold write actions and halve jev-browse run time ([#102](#102)) ([9ca9386](9ca9386)) * **serve:** mask password field values in /snapshot ([#109](#109)) ([2a352b5](2a352b5)) * **serve:** session lease - one driver at a time, with takeover ([#69](#69)) ([87724c8](87724c8)) ### Bug Fixes * **backend:** keep profile cleanup and remote argv from reaching past their own ([#92](#92)) ([f52cfd3](f52cfd3)) * **cli:** close the gaps a review of the lifecycle fixes found ([#90](#90)) ([c46aa5e](c46aa5e)) * **cli:** close the lifecycle gaps a stress run left open ([#88](#88)) ([899a535](899a535)) * **cli:** discarding the profile removes the instance's host snapshot dir ([#113](#113)) ([57cd07a](57cd07a)) * **cli:** downloads --wait accepts a finished download, logs drops D-Bus spam ([#111](#111)) ([dcc2f46](dcc2f46)) * **cli:** name the in-page dialog behind a pw click timeout ([#99](#99)) ([11beeeb](11beeeb)) * **cli:** never fall back to another instance when the selected one is stopped ([#78](#78)) ([a1df361](a1df361)) * **cli:** re-attach the driver after a restart leaves a stale session ([#77](#77)) ([bbeb0f0](bbeb0f0)) * **cli:** run --extract on every ending, not only done ([#71](#71)) ([4954195](4954195)) * **jev:** judge done on the page that landed, and end done on a none above even odds ([#108](#108)) ([a9cb5a8](a9cb5a8)) * **jev:** offer filter-apply controls the write gate withheld ([#114](#114)) ([bdf440a](bdf440a)) * **jev:** read quoted snapshot lines and keep field values out of --extract ([#89](#89)) ([09111a2](09111a2)) * **pw:** compact find output, downloads into a directory, quieter logs ([#116](#116)) ([62f2ca8](62f2ca8)) * **pw:** snapshot links a host file like an action, and the console log line names its verb ([#110](#110)) ([c902c58](c902c58)) * **serve:** dismiss a native dialog the driver leaves open ([#87](#87)) ([14f24cb](14f24cb)) * **serve:** keep the default seed's downloads across browser relaunch ([aac8e40](aac8e40)) * **serve:** keep the dialog watch alive through a signal shutdown ([#94](#94)) ([4f4f1d0](4f4f1d0)) * **serve:** pool-mode reaping, capture tab, hung tabs and launch bursts ([#86](#86)) ([3b42ea2](3b42ea2)) * **serve:** skip an idle reap whose timer a launch has since re-armed ([#93](#93)) ([c667868](c667868)) * **smoke:** never exec into a container the run was not pointed at ([#79](#79)) ([9075244](9075244)) * **viewer:** keep websocket inside proxy prefix ([#62](#62)) ([3b10ba7](3b10ba7)) ### Performance Improvements * **cli:** run a pw verb in one docker exec, lease check included ([#100](#100)) ([a9c3c90](a9c3c90)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
--extractonly ran on the done path, so a run that ended blocked (3) or out ofbudget (4) threw away the lines the caller asked for by name - even though the
session is still live on exactly the page the run stopped on, which is the whole
point of the handoff design. The documented lifetime of the extract criteria is
"runs once against the page the run ended on"
(
docs/knowledge/references/jev-browser-cli-surfaces.md), and no surveyedproject in the ecosystem gates extraction on success.
How
The extract now runs from
stop(), which is exactly the set of non-errorendings - done, blocked, max-steps. The error path (exit 1) never calls
stop(),so a run whose driver broke is not asked to read a page it could not snapshot.
stop()and a failure there is stillthe task is done at <url>, but the extract failed: ...with exit 1.(
cuttle jev-browse: the extract failed: ..., or{"extract":...,"failed":true,"trouble":...}under--json) and the originalexit code stands - masking a 3 or a 4 with a 1 would cost the caller the one
thing it branches on.
--jsonemits the same{"extract","lines"}object it emits today, ahead ofthe outcome object, on every ending that ran it.
--mock+--extractstill fails up front innewLoop(errMockExtract).The guard matters more now, not less: the mock reaches an extract on every
ending, and it has no judgement to pick lines with.
The brief that follows still names the page (
page: <url>plus "the browsersession is live at exactly this page"), so it stays clear where the lines came
from.
Tests
TestRunExtractsOnABlockedEndingTestRunExtractsWhenTheBudgetRunsOut(also covers the--jsonshape)TestRunExtractFailureKeepsTheExitCodeAll three fail on
main'sloop.goand pass with it.just checkgreen.Release notes
cuttle jev-browse --extractnow runs against the page the run ended on for every outcome, not only when the task finished: a blocked or out-of-steps run prints its lines too. Exit codes are unchanged; an extract that fails there prints one note and keeps its code.